//
//  NSString+Base64.m
//  HKHttpManager
//
//  Created by hans on 2018/1/4.
//  Copyright © 2018年 hans. All rights reserved.
//

#import "NSString+Base64.h"

@implementation NSString (Base64)
- (NSString *)Kratos_base64EncodedString;{
    NSData *data = [self dataUsingEncoding:NSUTF8StringEncoding];
    return [data base64EncodedStringWithOptions:0];
}

- (NSString *)Kratos_base64DecodedString{
    NSData *data = [[NSData alloc]initWithBase64EncodedString:self options:0];
    return [[NSString alloc]initWithData:data encoding:NSUTF8StringEncoding];
}
/// 给当前文件追加文档路径
- (NSString *)Kratos_appendCacheDir_Kratos
{
    NSString *cache =  NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES).lastObject;
    return  [cache stringByAppendingPathComponent: [self lastPathComponent]];
}

///获取临时文件夹路径
- (NSString *)Kratos_appendTempDir_Kratos
{
    NSString *cache = NSTemporaryDirectory();
    return  [cache stringByAppendingPathComponent: [self lastPathComponent]];
}


/// 给当前文件追加临时路径
- (NSString *)Kratos_appendDocumentDir_Kratos
{
    NSString *cache =  NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES).lastObject;
    return  [cache stringByAppendingPathComponent: [self lastPathComponent]];
}

@end
